<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

<head>
	<sx:head cache="true" />
	<link rel="stylesheet" href="/hrs-intranet/styles/displaytag.css" type="text/css" />
	<script type="text/javascript" src="/hrs-intranet/custom/js/calendarFix.js"></script>
</head>

	<script type="text/javascript">
		function generateReport() {
			// Llamo al action que agrega la accion.
			document.forms[0].action = "MentoringRelationshipsReportAction";
  			document.forms[0].submit();
		}
	</script>

<s:if test="hasFieldErrors()">
	<div class="oldErrorMsg">
		<h4 class="oldErrorTitle"><s:property value="error.title"/></h4>
		<s:iterator value="fieldErrors">
			<s:iterator value="value">
				<li>
					<font class="errorMsgFont">
						<s:property/>
					</font>
				</li>
			</s:iterator>
		</s:iterator>
	</div>
	<br/>
	<br/>
</s:if>

<s:form action="MentoringAction_listWithValidation" cssClass="formClass" id="mentorForm" >

	<s:include value="mentoringFilterTags.jsp"></s:include>

	<s:if test="hasPermission(permissionNameConverter.getGenerateMentoringRelationshipReportPermission())" >
		<span class="pageLink" style="position:relative; left:520px; top:20px;" >
			<s:a onclick="generateReport()" cssStyle="cursor:hand" ><s:text name="report.generate"/></s:a>
 	    </span>
 	</s:if>

	<td colspan="2">
		<div id="btnHolder">
			<s:submit type="reset" key="button.reset" cssClass="btn"
				cssStyle="position:relative; left: -77px; text-align: center" action="MentoringAction_reset"  />
			<s:submit key="button.filter" cssClass="btn"
				id="okbtn" cssStyle="position:relative; left:-175px; top:-28px; text-align: center;" />
		</div>
	</td>

	<s:if test="%{listRelationships.size()==0}">
		<td><s:label key="table.noResult.message" label="" cssClass="formClass"></s:label></td>
	</s:if>
	<s:else>
		<table width="67%">
			<tr>
				<td colspan="2">
					<display:table name="listRelationships" defaultsort="3" defaultorder="descending" requestURI="MentoringAction_list" class="listable" cellpadding="0" cellspacing="0" pagesize="10" >
						<display:column property="mentor.person.name" titleKey="mentor" sortable="true" />
						<display:column property="mentee.person.name" titleKey="mentee" sortable="true" />
						<display:column property="lastMeeting" titleKey="lastMeeting" sortable="true" format="{0,date,dd/MM/yyyy}" />
						<display:column property="nextMeeting" titleKey="nextMeeting" sortable="true" format="{0,date,dd/MM/yyyy}" />
						<display:column property="mentoringPeriod" titleKey="mentoringPeriod" sortable="true"  />
					</display:table>
				</td>
			</tr>
		</table>
	</s:else>
</s:form>
